package com.flame.core.protocol;

import java.util.List;

import com.flame.core.mybatis.PageBody;

/**
 *
 *
 * @author wuxintong
 * @since 2022/9/11
 */
public class PageResult {

    private String code;

    private String msg;

    private PageBody data;

    public static PageResult success() {
        PageResult result = new PageResult();
        result.setCode("0");
        result.setMsg("success");
        return result;
    }

    public static PageResult success(List data) {
        PageResult result = new PageResult();
        result.setCode("0");
        result.setMsg("success");
        result.setData(new PageBody(data));
        return result;
    }

    public static PageResult failure() {
        PageResult result = new PageResult();
        result.setCode("-1");
        result.setMsg("failure");
        return result;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public PageBody getData() {
        return data;
    }

    public void setData(PageBody data) {
        this.data = data;
    }

    public PageResult code(String code) {
        this.setCode(code);
        return this;
    }

    public PageResult msg(String msg) {
        this.setMsg(msg);
        return this;
    }

    public PageResult data(PageBody data) {
        this.setData(data);
        return this;
    }
}
